		$(function() {
			$('select[name=team]').val('${filter.team!}');
			$('select[name=userType]').val('${filter.userType!}');
			$('select[name=notTrainCourse]').val('${filter.notTrainCourse!}');
			$('select[name=year]').val('${year!}');
			$('select[name=month]').val('${month!}');
			
			$('#searchForm').validate({
				rules: {
					notTrainCourse: "required",
					team: "required",
					year: {
						required: true
					},
					month: {
						required: true
					}
				}
			});
			
			// Upload Plugin itself
      		$('#importForTraining #drag-and-drop-zone').dmUploader({
        		url: '${base}/user/upload/training',
        		dataType: 'json',
        		//allowedTypes: 'image/*',
        		/*extFilter: 'jpg;png;gif',*/
        		onBeforeUpload: function(id){
          			add_log('Starting the upload of #' + id);
          
          			update_file_status(id, 'uploading', 'Uploading...');
        		},
        		onNewFile: function(id, file){
          			clearLog();
          			
          			add_log('New file added to queue #' + id);
        		},
        		onComplete: function(){
          			add_log('All pending tranfers finished');
        		},
        		onUploadProgress: function(id, percent){
          			var percentStr = percent + '%';

          			update_file_progress(id, percentStr);
        		},
        		onUploadSuccess: function(id, data){
          			add_log('Upload of file #' + id + ' completed');
          
          			add_log('Server Response for file #' + id + ': ' + JSON.stringify(data));
          
          			update_file_status(id, 'success', 'Upload Complete');
          
          			update_file_progress(id, '100%');
        		},
        		onUploadError: function(id, message){
          			add_log('Failed to Upload file #' + id + ': ' + message);
          
          			update_file_status(id, 'error', message);
        		},
        		onFileTypeError: function(file){
          			add_log('File \'' + file.name + '\' cannot be added: must be an image');
          
        		},
        		onFileSizeError: function(file){
          			add_log('File \'' + file.name + '\' cannot be added: size excess limit');
        		},
        		/*onFileExtError: function(file){
          			$.danidemo.addLog('#demo-debug', 'error', 'File \'' + file.name + '\' has a Not Allowed Extension');
        		},*/
        		onFallbackMode: function(message){
          			alert('Browser not supported(do something else here!): ' + message);
        		}
      		});
      		
      		$('#importForTransfer #drag-and-drop-zone').dmUploader({
	    		url: '${base}/user/upload/transfer',
	    		dataType: 'json',
	    		//allowedTypes: 'image/*',
	    		/*extFilter: 'jpg;png;gif',*/
	    		onBeforeUpload: function(id){
	      			add_log('Starting the upload of #' + id);
	      
	      			update_file_status(id, 'uploading', 'Uploading...');
	    		},
	    		onNewFile: function(id, file){
	    			clearLog();
	    		
	      			add_log('New file added to queue #' + id);
	    		},
	    		onComplete: function(){
	      			add_log('All pending tranfers finished');
	    		},
	    		onUploadProgress: function(id, percent){
	      			var percentStr = percent + '%';
	
	      			update_file_progress(id, percentStr);
	    		},
	    		onUploadSuccess: function(id, data){
	      			add_log('Upload of file #' + id + ' completed');
	      
	      			add_log('Server Response for file #' + id + ': ' + JSON.stringify(data));
	      
	      			update_file_status(id, 'success', 'Upload Complete');
	      
	      			update_file_progress(id, '100%');
	    		},
	    		onUploadError: function(id, message){
	      			add_log('Failed to Upload file #' + id + ': ' + message);
	      
	      			update_file_status(id, 'error', message);
	    		},
	    		onFileTypeError: function(file){
	      			add_log('File \'' + file.name + '\' cannot be added: must be an image');
	      
	    		},
	    		onFileSizeError: function(file){
	      			add_log('File \'' + file.name + '\' cannot be added: size excess limit');
	    		},
	    		/*onFileExtError: function(file){
	      			$.danidemo.addLog('#demo-debug', 'error', 'File \'' + file.name + '\' has a Not Allowed Extension');
	    		},*/
	    		onFallbackMode: function(message){
	      			alert('Browser not supported(do something else here!): ' + message);
	    		}
	  		});
	  		
	  		$('#importForDimission #drag-and-drop-zone').dmUploader({
	    		url: '${base}/user/upload/dimission',
	    		dataType: 'json',
	    		//allowedTypes: 'image/*',
	    		/*extFilter: 'jpg;png;gif',*/
	    		onBeforeUpload: function(id){
	      			add_log('Starting the upload of #' + id);
	      
	      			update_file_status(id, 'uploading', 'Uploading...');
	    		},
	    		onNewFile: function(id, file){
					clearLog();
					
	      			add_log('New file added to queue #' + id);
	    		},
	    		onComplete: function(){
	      			add_log('All pending tranfers finished');
	    		},
	    		onUploadProgress: function(id, percent){
	      			var percentStr = percent + '%';
	
	      			update_file_progress(id, percentStr);
	    		},
	    		onUploadSuccess: function(id, data){
	      			add_log('Upload of file #' + id + ' completed');
	      
	      			add_log('Server Response for file #' + id + ': ' + JSON.stringify(data));
	      
	      			update_file_status(id, 'success', 'Upload Complete');
	      
	      			update_file_progress(id, '100%');
	    		},
	    		onUploadError: function(id, message){
	      			add_log('Failed to Upload file #' + id + ': ' + message);
	      
	      			update_file_status(id, 'error', message);
	    		},
	    		onFileTypeError: function(file){
	      			add_log('File \'' + file.name + '\' cannot be added: must be an image');
	      
	    		},
	    		onFileSizeError: function(file){
	      			add_log('File \'' + file.name + '\' cannot be added: size excess limit');
	    		},
	    		/*onFileExtError: function(file){
	      			$.danidemo.addLog('#demo-debug', 'error', 'File \'' + file.name + '\' has a Not Allowed Extension');
	    		},*/
	    		onFallbackMode: function(message){
	      			alert('Browser not supported(do something else here!): ' + message);
	    		}
	  		});
		});
		
		//-- Some functions to work with our UI
	    function add_log(message){
	        var template = '<li>[' + new Date().getTime() + '] - ' + message + '</li>';
	        
	    	$('#importForTransfer #debug').find('ul').prepend(template);
	        $('#importForTraining #debug').find('ul').prepend(template);
	        $('#importForDimission #debug').find('ul').prepend(template);
		}
		
		funciton clearLog(){
			$('#importForTransfer #debug').find('ul').empty();
			$('#importForTraining #debug').find('ul').empty();
			$('#importForDimission #debug').find('ul').empty();
		}
	      
	    function update_file_status(id, status, message){
	        $('#uploadFile' + id).find('span.status').html(message).addClass(status);
	    }
	      
	    function update_file_progress(id, percent){
	    	$('#uploadFile' + id).find('div.progress').width(percent);
	    }